package com.itheima.chapter09.io.objectstream;

import java.io.*;

public class Tips {
    public static void main(String[] args) throws IOException, ClassNotFoundException {
        //1.序列化
        ObjectOutputStream oos =new ObjectOutputStream(new FileOutputStream("MyIdeaTest\\tips.txt"));
        User u1= new User("zhangsan","123456");
        oos.writeObject(u1);
        oos.close();
        //2.修改User类变量权限
        //3.反序列化
        ObjectInputStream ois =new ObjectInputStream(new FileInputStream("MyIdeaTest\\tips.txt"));
        Object User = ois.readObject();
        System.out.println(User);
        ois.close();
    }

}
